<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script src="jquery-3.6.0.min.js"></script>
  <style>
    div {
      width: 50px;
      height: 50px;
      border: 1px solid black;
      position: absolute;
      left: 20px;
      top: 20px;
    }
  </style>
</head>
<body>
  <div></div>
  <script>
    // 获取元素的尺寸和位置
    console.log($('div').width());
    console.log($('div').height());
    console.log($('div').offset());
    // 设置元素的尺寸和位置
    $('div').width(100);
    $('div').height(100);
    $('div').offset({ top: 50, left: 50 });
  </script>
</body>
</html>